.\" Copyright (C) 2010-2012 Shang-Rong Cai. All rights reserved.
.\" 
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $ Bitmap: bitmap.3    Rev. 1.1.0    2012-10-12T07:51+08:00 $
.TH "BITMAP" 3 2012-10-12 "Bitmap 1.2" "Bitmap Library Manual"
.SH NAME
\fBbitmap_t\fP, \fBbitmap_init\fP, \fBbitmap_dest\fP - Bitmap data structure
.SH SYNOPSIS
\fB#include <bitmap.h>\fP

\fIbitmap_t\fP \fIbm\fP;

\fIint\fP
.br
\fBbitmap_init\fP(\fIbitmap_t\fP \fI*bm\fP, \fIsize_t\fP \fIsz\fP);

\fIint\fP
.br
\fBbitmap_dest\fP(\fIbitmap_t\fP \fI*bm\fP);

.SH DESCRIPTION
The data structure bitmap means a sequence of bits, the definition and the 
parameters of basic handle function are stated in the below.
.TP
\fPbm\fP
The data structure object.
.TP
\fBsz\fP
The length the bits sequence.

.LP
.nf
typedef struct
{
    size_t bksz;  /* Block size */
    size_t size;  /* Array size */
    uint8_t *list;
} bitmap_t;

.fi
This data structure must initialized by the function \fBbitmap_init\fP() to 
allocated memory before using, but it does not set the bit value of all to be 
\fBmark (1)\fP or \fBnone (0)\fP in the array.  Thus, it is necessary to set 
the default status by calling the function \fBbitmap_all_mark\fP() to make all 
be \fBmark\fP or the function \fBbitmap_all_none\fP() to make all be 
\fBnone\fP.  While do not using, to call the destroying function 
\fBbitmap_dest\fP() releasing the memory.

.SH RETURN VALUES
The default return is the error number where upon successful completion returns 
\fBERRNO_UNDEFINED\fP.  If the initialization \fBbitmap_init\fP() failed may 
often return value equal to \fBERRNO_CANNOT_ALLOCATE_MEMORY\fP for system 
memory may be not enought to use.

.SH SEE ALSO
bscerr(3), bitmap_all_mark(3), bitmap_all_none(3)

